home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / chat / ircii-2.8he / ircii-2 / help / ASSIGN < prev    next >
Encoding:
Text File  |  1993-05-04  |  2.5 KB  |  69 lines

  1. Usage: ASSIGN [[-]<user-variable> [<whatever>]]
  2.   ASSIGN lets you create user variables which are automatically
  3.   expanded by ircII in aliases using the $variable-name format.
  4.   For example, if you had defined:
  5.     ASSIGN me The Big Cheese
  6.   Then, in an alias, $me would expand to "The Big Cheese".  These
  7.   are straight textual substitutions.  You can use these kind
  8.   of variables as counters and indexes into lists as well.  For
  9.   example:
  10.     ASSIGN index 0
  11.     ASSIGN index ${index+1}
  12.   The first line sets "index" to 0, the seconds increments index by 1.
  13.   Note that the second will always be expanded if used in another
  14.   alias (where $ are normally expanded).  If you want it to be
  15.   expanded if typed at the input line, you must first set
  16.   INPUT_ALIASES to ON.
  17.  
  18.   Note: In the above example, the mathematical expression must be
  19.   enclosed by {}'s  otherwise the + would be treated as an alias
  20.   delimiter and the addition not performed. (See @ as well)
  21.  
  22.   Suppose now you wanted to use index to get a single word in a list, 
  23.   you could do:
  24.     ALIAS WORD ECHO $($index)
  25.   Then doing:
  26.     WORD This is a test
  27.   would display the index'th word in the list.  
  28.   The $($index) format does the following: it parses the text
  29.   between the () as a sub-alias.  The "$index" is thus evaluated
  30.   and returns it's value.  This value is then replaced for the () 
  31.   expression and evaluated.  So, if you had:
  32.     ASSIGN index 1
  33.   Then, the following would be evaluated:
  34.     $index becomes 1 which given
  35.     $(1) which becomes simply $1
  36.   Thus the $1 argument is used.  
  37.   This functionality can be nested. This the following:
  38.     ASSIGN A Hey You!
  39.     ASSIGN B A
  40.     ASSIGN C B
  41.     ALIAS NESTING echo $($($C))
  42.   will cause NESTING to display "Hey You!"
  43.  
  44.   The following format are also legal:
  45.     $#name    evaluates to the number of words in name
  46.     $@name    evaluates to the number of characters in name
  47.   You can use these with the mathematical expressions as well, 
  48.   for example:
  49.     ASSIGN foo Testing One Two
  50.     ECHO $#foo $@foo
  51.     ASSIGN junk ${#foo + @foo}
  52.   The ECHO line will display 3 15 and the variable junk have the 
  53.   value 18.
  54.  
  55.   Additionally, values assigned to FUNCTION_RETURN are taken to be
  56.   the return value of a function.
  57.  
  58. IMPORTANT NOTE:
  59.   There is a special version of this command called '@'
  60.   for use in aliases and scripts.  It is well suited to mathematical
  61.   operations.  Its use over ASSIGN is highly recommended.
  62.  
  63. See Also:
  64.   @
  65.   ALIAS
  66.   IF
  67.   SET INPUT_ALIASES
  68.   ALIAS functions
  69.